<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>rasterizehtml</title>
    <style>
        .canvasss{
            width:1000px;
            height:800px;
            
        }
    </style>
</head>
<body>
    <div></div>
    <canvas class="canvasss" id="canvas"></canvas>
    <a id="download">下载</a>
    <script type="text/javascript" src="rasterizeHTML.allinone.js"></script>
    <script>
        var canvas = document.getElementById("canvas");
        rasterizeHTML.drawHTML('Some ' + '<span style="color: green; font-size: 20px;">HTML</span>' + ' with an image', canvas);
        let download = document.getElementById('download');

        function downloadCanvas(link, canvasId, filename) {
            link.href = document.getElementById(canvasId).toDataURL();
            link.download = filename;
        }

        download.onclick = function(e){
            downloadCanvas(this,'canvas','test.png')
        }
    </script>
</body>
</html>